import request from '@/utils/request'
import type { Admin } from '@/views/Login/type'
import type { ResponseData } from '../type'

// 管理员信息管理

// 注册
export const adminRegisterApi = (admin: Admin) => request.post<any, ResponseData>('/admin/register', admin)

// 登录
export const adminLoginApi = (key: any, admin: Admin) => request.post<any, any>('/admin/login?key=' + key, admin)

// 状态统计
export const adminStatusCountApi = () => request.get('/admin/statusCount')

// 查询全部管理员信息
export const adminFindAllApi = () => request.get<any, any>('/admin')

// 条件查询query参数格式
export const adminFindBySearchApi = (params: any) => request.get<any, any>('/admin/search', { params })

// 新增/修改
export const adminSaveApi = (admin: any) => request.post('/admin', admin)

// 删除
export const adminDeleteApi = (id: string) => request.delete('/admin/' + id)
